﻿using System;
using System.Collections.Generic;
using System.Text;
using Abp.Application.Services.Dto;
using HCD.User.Dtos;

namespace HCD.Web.Authorizer
{
    /// <summary>
    /// 身份模型
    /// </summary>
    public class AuthModel : EntityDto<long>
    {
        /// <summary>
        /// 工号
        /// </summary>
        public string EmpNo { get; set; }
        /// <summary>
        /// 会员ID
        /// </summary>
        public string UserName { get; set; }
        /// <summary>
        /// 用户名
        /// </summary>
        public string Name { get; set; }
        /// <summary>
        /// 分院编码
        /// </summary>
        public string HospitalCode { get; set; }
        /// <summary>
        /// 是否管理员
        /// </summary>
        public bool IsAdmin { get; set; }
        /// <summary>
        /// 租户ID
        /// </summary>
        public int? TenantID { get; set; }

        /// <summary>
        /// 过期时间
        /// </summary>
        public DateTime Exp { get; set; }

        public string PhoneNumber { get; set; }

        public static implicit operator AuthModel(UserDto v)
        {
            return new AuthModel
            {
                Id = v.Id,
                IsAdmin = false,
                PhoneNumber = v.PhoneNumber,
                Name = v.Name,
                UserName = v.UserName,
                EmpNo = v.EmpNo,
                HospitalCode = v.HospitalCode
            };
        }
    }
}